// Removes whitespace characters from the beginning and end of a string
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, "");
}